package WaiBao;

import java.util.Arrays;

public class LiangQiXing {
    public static void main(String[] args) {
        String[] name = {"李现(班长)", "肖战(副班长)", "小李(学习委员)", "邓伦(体育委员)", "邓丽君", "等亚茹", "张鹏伟", "张晓峰", "郭规财", "李翔宇", "张浩宇","李军",
                "高博", "王战", "王世杰", "陈浩南", "李天乐", "王大祥", "王嘉尔", "郭金明", "李存存", "王迅", "王菲", "杨幂", "杨洋", "刘恺威", "贾乃亮", "李向科",
                "杨清柠", "梁其杏(心理委员)"};//考生本人:梁其杏(心理委员)
        int[] age = {20, 21, 19, 21, 21, 22, 21, 20, 19, 19, 18, 18, 19, 21, 22, 19, 19, 18, 18,20, 19, 19, 20, 20, 20, 18, 20, 21, 20, 20};//最后一位考生年龄：20岁

        double[] lele1 = {81, 84, 84, 85, 78, 69, 78, 89, 80, 91, 94, 87, 85, 74, 75, 78, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 78, 85, 96};
        double[] lele2 = {75, 74, 74, 88, 84, 76, 84, 74, 71, 80, 84, 78, 87, 77, 85, 65, 70, 74, 76, 68, 92, 71, 95, 81, 75, 84, 76, 97, 95, 96};
        double[] lele3 = {76, 90, 71, 85, 71, 69, 78, 80, 81, 69, 93, 87, 85, 75, 68, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 75, 71, 81, 96};


        double junke1;//代表每个学生的总分
        double junke2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            junke1 = lele1[i] +lele2[i] +lele3[i];
//            junke2 = ( junke1* 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + junke1);
//            System.out.println(name[i] + "的平均分为:" +junke2);
//        }


        double yanjing1 = 0, yanjing2 = 0;
        double[] jiuzhang = new double[30];
//        for (int i = 0; i < 30; i++) {
//            yanjing1 = lele1[i] + lele2[i] +lele3[i];
//            yanjing2 = (yanjing1 * 1.0) / 3;
//            jiuzhang[i] = yanjing2;
//        }
//
//        for (int i = 0; i <jiuzhang.length - 1; i++) {
//            for (int j = 0; j < jiuzhang.length - i - 1; j++) {
//                if (jiuzhang[j] < jiuzhang[j + 1]) {
//                    double tep = jiuzhang[j];
//                    jiuzhang[j] = jiuzhang[j + 1];
//                    jiuzhang[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(jiuzhang[i]);
//        }


        double yuliang1 = 0,yuliang2 = 0, yuliang3 = 0;//计算每门课的平均分
        double tongwei1 = 0,tongwei2 = 0, tongwei3 = 0;//计算每门课标准差
        double dengdneg1 = 0,dengdneg2 = 0,dengdneg3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i <lele1.length; i++) {
            sum2+=lele1[i];
        }
        yuliang1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+yuliang1);
        double Sum = 0;
        for (int i = 0; i <lele2.length; i++) {
            Sum+=lele2[i];
        }
        yuliang2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+yuliang2);
        double sum = 0;
        for (int i = 0; i <lele3.length; i++) {
            sum+=lele3[i];
        }
        yuliang3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+yuliang3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <lele1.length; i++) {
            c1+= (lele1[i] -yuliang1)*(lele1[i] -yuliang1);
        }
        tongwei1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+tongwei1);

        for (int i = 0; i < lele2.length; i++) {
            c2+= (lele2[i] -yuliang2)*(lele2[i] - yuliang2);
        }
        tongwei2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+tongwei2);

        for (int i = 0; i < lele3.length; i++) {
            c3+= (lele3[i] -yuliang3)*(lele3[i] - yuliang3);
        }
        tongwei3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+tongwei3);
//////////
//////////
        Arrays.sort(lele1);
        Arrays.sort(lele2);
        Arrays.sort(lele3);
        dengdneg1 =(lele1[14]+lele1[15])*1.0/2;
        dengdneg2 =( lele2[14]+lele2[15])*1.0/2;
        dengdneg3 =( lele3[14]+lele3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+dengdneg1);
        System.out.println("微生物学的中位数为:"+dengdneg2);
        System.out.println("人体组织解剖学的中位数为:"+dengdneg3);



    }
}
